//
//  WeeViewController.m
//  emark
//
//  Created by zhoucan on 2018/3/27.
//  Copyright © 2018年 neebel. All rights reserved.
//

#import "WeeViewController.h"

@interface WeeViewController ()

@property (weak, nonatomic) IBOutlet UIWebView *webView;


@end

@implementation WeeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    if (_isHidden) {
        self.navigationController.navigationBar.hidden = YES;
    }else{
        self.navigationController.navigationBar.hidden = NO;
    }
    
    NSURL * u = [NSURL URLWithString:_url];
    NSURLRequest * re = [NSURLRequest requestWithURL:u];
    [self.webView loadRequest:re];
    
    //添加一个轻扫手势
    
    UISwipeGestureRecognizer *swip = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(back)] ;
    
    
    
    [self.webView addGestureRecognizer:swip];
    
    
    // Do any additional setup after loading the view from its nib.
}

- (void)back

{
    
    if (self.webView.canGoBack)
    {
        [self.webView goBack];
    }
    
    
    
}

- (IBAction)backButtonPush {
    if (self.webView.canGoBack)
    {
        [self.webView goBack];
    }
}
- (IBAction)forwardButtonPush {
    if (self.webView.canGoForward)
        
    {
        [self.webView goForward];
    }
}

- (IBAction)reloadButtonPush {
    
    [self.webView reload];
}


- (IBAction)stopButtonPush {
    
    if (self.webView.loading)
    {
        [self.webView stopLoading];
    }
    
}

-(void)setUrl:(NSString *)url{
    
    _url = url;
    
   
    
    
}

-(void) setIsHidden:(BOOL)isHidden{
    
    _isHidden = isHidden;
   
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end

